import React, { Component } from 'react';

/* 
    1.组件加载时
    componentWillUnmount
*/
class Dome extends Component{
  render(){
    return <h1>dome组件</h1>
  }
  componentWillUnmount(){
    console.log("Dome组件卸载")
  }
}
class App extends Component {
  state={
    show:true
  }
  handleClick = (params) => {
    this.setState({
      show:false,
    })
  }
  render() {
    return (
      <div>
      { this.state.show?<Dome></Dome>:""}
      <button onClick={this.handleClick}>点击卸载</button>
      </div>
    );
  }
}

export default App;
